var express = require('express');
var router = express.Router();

// 中间件1，检查 token
router.use((req, res, next)=>{
  let token = '123456789';
  var accessToken = req.query.token;
  if (token === accessToken){
    next();
  }else{
    res.send({
      errCode: 1,
      errMsg: '请求必须包含 token'
    });
  }
});

/* GET users listing. */
router.get('/', function(req, res, next) {
  res.send('respond with a resource');
});

module.exports = router;
